//
//  UIColor+GColor.m
//  chuandai
//
//  Created by xiaohai on 15/12/16.
//  Copyright © 2015年 com.17find. All rights reserved.
//

#import "UIColor+GColor.h"

@implementation UIColor (GColor)
+(UIColor*) color3{
    return [UIColor colorWithRed:51.0f/255.0f green:51.0f/255.0f blue:51.0f/255.0f alpha:1.0];
}

//+(UIColor*) color2{
//    return [UIColor colorWithRed:34.0f/255.0f green:34.0f/255.0f blue:34.0f/255.0f alpha:1.0];
//}

+(UIColor*) color6{
    return [UIColor colorWithRed:102.0f/255.0f green:102.0f/255.0f blue:102.0f/255.0f alpha:1.0];
}
+(UIColor*) color9{
    return [UIColor colorWithRed:153.0f/255.0f green:153.0f/255.0f blue:153.0f/255.0f alpha:1.0];
}
+(UIColor*) colorBlue1{
    return [UIColor colorWithRed:0.0f/255.0f green:180.0f/255.0f blue:237.0f/255.0f alpha:1.0];
}
+(UIColor*) colorE{
    return [UIColor colorWithRed:238.0f/255.0f green:238.0f/255.0f blue:238.0f/255.0f alpha:1.0];
}
+(UIColor*) colorC{
    return [UIColor colorWithRed:204.0f/255.0f green:204.0f/255.0f blue:204.0f/255.0f alpha:1.0];
}
+(UIColor*) colorD{
    return [UIColor colorWithRed:221.0f/255.0f green:221.0f/255.0f blue:221.0f/255.0f alpha:1.0];
}


+(UIColor*) colorXun{
    return [UIColor colorWithRed:0.0f/255.0f green:193.0f/255.0f blue:114.0f/255.0f alpha:1.0];
}
+(UIColor*) colorQ{
    return [UIColor colorWithRed:24.0f/255.0f green:142.0f/255.0f blue:247.0f/255.0f alpha:1.0];
}
+(UIColor*) colorF{
    return [UIColor colorWithRed:240.0f/255.0f green:240.0f/255.0f blue:240.0f/255.0f alpha:1.0];
}
+(UIColor*) colorG{
    return [UIColor colorWithRed:245.0f/255.0f green:245.0f/255.0f blue:245.0f/255.0f alpha:1.0];
}
+(UIColor*) colorH{
    return [UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0];
}
+(UIColor *)colorI
{
 return [UIColor colorWithRed:251.0f/255.0f green:88.0f/255.0f blue:113.0f/255.0f alpha:1.0];
}
+ (UIColor *) colorWithHexString: (NSString *)color
{
    NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
    
    // String should be 6 or 8 characters
    if ([cString length] < 6) {
        return [UIColor clearColor];
    }
    // 判断前缀
    if ([cString hasPrefix:@"0X"])
        cString = [cString substringFromIndex:2];
    if ([cString hasPrefix:@"#"])
        cString = [cString substringFromIndex:1];
    if ([cString length] != 6)
        return [UIColor clearColor];
    // 从六位数值中找到RGB对应的位数并转换
    NSRange range;
    range.location = 0;
    range.length = 2;
    //R、G、B
    NSString *rString = [cString substringWithRange:range];
    range.location = 2;
    NSString *gString = [cString substringWithRange:range];
    range.location = 4;
    NSString *bString = [cString substringWithRange:range];
    // Scan values
    unsigned int r, g, b;
    [[NSScanner scannerWithString:rString] scanHexInt:&r];
    [[NSScanner scannerWithString:gString] scanHexInt:&g];
    [[NSScanner scannerWithString:bString] scanHexInt:&b];
    
    return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:1.0f];
}


@end



